package com.gzf.service.impl;

import com.alibaba.fescar.core.context.RootContext;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gzf.mapper.AnimalMapper;
import com.gzf.pojo.Animal;
import com.gzf.service.AnimalService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author gzf
 * @since 2019-07-26
 */
@Slf4j
@Service
public class AnimalServiceImpl extends ServiceImpl<AnimalMapper, Animal> implements AnimalService {

    @Resource
    private AnimalMapper animalMapper;

    @Transactional
    @Override
    public boolean save(Animal animal) {
        log.info("animal Service Begin ... xid: " + RootContext.getXID());
        int save = animalMapper.save(animal);
        log.info("animal end...");
        if (save < 0) {
            return false;
        }
        return true;
    }
}
